package com.csdj.youxi.service;

import com.csdj.youxi.entity.AppInfo;
import com.csdj.youxi.entity.AppInfoExample;
import com.csdj.youxi.mapper.AppInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AppInfoService implements IAppInfoService{

    @Autowired
    private AppInfoMapper appInfoMapper;

    @Override
    public List<AppInfo> selAi() {
        AppInfoExample example  = new AppInfoExample();
        example.createCriteria();
        return appInfoMapper.selectByExample(example);
    }

    @Override
    public AppInfo selAiCha(int id) {
        AppInfoExample example  = new AppInfoExample();
        example.createCriteria().andIdEqualTo(id);
        return appInfoMapper.selectByExample(example).get(0);
    }

    @Override
    public int insertAi(AppInfo appInfo) {
        return appInfoMapper.insert(appInfo);
    }

    @Override
    public int updateAi(AppInfo appInfo) {
        return appInfoMapper.updateByPrimaryKey(appInfo);
    }

    @Override
    public int deleteAi(int id) {
        return appInfoMapper.deleteByPrimaryKey(id);
    }
}
